/*****************************************************************************
Copyright 2006 Kervin L. Pierre
    EMAIL: otlkcon@adevsoft.com

This file is part of Otlkcon.

Otlkcon is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

Otlkcon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Lesser GNU General Public License for more details.

You should have received a copy of the Lesser GNU General Public License
along with Otlkcon; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*******************************************************************************/

#pragma once

#include <string>
#include <iostream>

using namespace std;

#include "resource.h"

#define OTLKCON_REG_KEY     L"Software\\Open Connector Groupware"
#define OTLKCON_REG_KEY_A   "Software\\Open Connector Groupware"

#define OUTLOOK_KEY             L"SOFTWARE\\Clients\\Mail\\Microsoft Outlook"
#define OUTLOOK_COMP_ID         L"MSIComponentID"
#define OUTLOOK_APP_ID          L"MSIApplicationLCID"
#define OUTLOOK_MAPISVCINF      L"MAPISVC.INF"
#define OUTLOOK_REGKEY_MAX_LEN  256
#define LINE_MAX                1024

#define OCHELPER_DEFAULT_DLL_NAME L"mstore32.dll"

#define OTLKCON_LOG_DEFAULT_FILE            L"C:\\ochelper.txt"
#define OTLKCON_LOG_MSG_MAX_LEN             65536
#define OTLKCON_LOG_SM_SUPPORT_ENABLED      0
#define OTLKCON_LOG_LEVEL_ALL           -1
#define OTLKCON_LOG_LEVEL_ERROR         1
#define OTLKCON_LOG_LEVEL_WARNING       2
#define OTLKCON_LOG_LEVEL_INFO          4
#define OTLKCON_LOG_LEVEL_SPECIAL_1     8
#define OTLKCON_LOG_LEVEL_SPECIAL_2     16
#define OTLKCON_LOG_LEVEL_SPECIAL_3     32
#define OTLKCON_LOG_LEVEL_DEFAULT       (OTLKCON_LOG_LEVEL_INFO|OTLKCON_LOG_LEVEL_WARNING|OTLKCON_LOG_LEVEL_ERROR)
/* First 16 bits of flag */
#define OTLKCON_LOG_TARGET_NONE 0
#define OTLKCON_LOG_TARGET_ALL  1
#define OTLKCON_LOG_TARGET_MSVC 2
#define OTLKCON_LOG_TARGET_SM   4
#define OTLKCON_LOG_TARGET_FILE 8
/* Second 16 bits of flag */
#define OTLKCON_LOG_FLAG_NO_DATE    131072
#define OTLKCON_DEFAULT_DEBUGLEVEL   -1

typedef BOOL (STDAPICALLTYPE FGETCOMPONENTPATH)
	(LPSTR szComponent,
	LPSTR szQualifier,
	LPSTR szDllPath,
	DWORD cchBufferSize,
	BOOL fInstall);
typedef FGETCOMPONENTPATH FAR * LPFGETCOMPONENTPATH;

HRESULT find_mapisvc(wstring *file);

HRESULT merge_mapisvcinf(wstring inifile, 
                          wstring mapisvcinf, 
                          wstring mapisvcinf_bak);

void print_options(int retVal, wstring str);
int LOG_PRINTF(int level, int flag, wchar_t *format, ...);

